package com.homework3;

public class Test {
    public static void main(String[] args) {
        //在main中有一些常量和一个二维数组
        final int EMPLOYEE = 10;//表示普通员工
        final int PROGRAMMER = 11;//表示程序员
        final int DESIGNER = 12;//表示设计师
        final int ARCHITECT = 13;//表示架构师


        //TODO 为解决的问题
        String[][] EMPLOYEES = {
                {"10", "1", "段誉", "22", "3000"},
                {"13", "2", "令狐冲", "32", "18000", "15000", "2000"},
                {"11", "3", "任我行", "23", "7000"},
                {"11", "4", "张三丰", "24", "7300"},
                {"12", "5", "周芷若", "28", "10000", "5000"},
                {"11", "6", "赵敏", "22", "6800"},
                {"12", "7", "张无忌", "29", "10800","5200"},
                {"13", "8", "韦小宝", "30", "19800", "15000", "2500"},
                {"12", "9", "杨过", "26", "9800", "5500"},
                {"11", "10", "小龙女", "21", "6600"},
                {"11", "11", "郭靖", "25", "7100"},
                {"12", "12", "黄蓉", "27", "9600", "4800"}
        };
        //（2）创建一个员工数组
        //（3）根据以上数据，初始化员工数组
        //提示：把字符串转为int和double类型的值，可以使用如下方式：
        //        String idStr = "1";
        //int id = Integer.parseInt(idStr);
        //
        //String salaryStr = "7300";
        //double salary = Double.parseDouble(salaryStr);

        //（4）遍历数组，使用如下格式
        System.out.println("编号\t姓名\t年龄\t工资\t职位\t奖金\t股票");
        // 原始数据数组

        // 创建员工对象数组
        Employee[] employees = new Employee[EMPLOYEES.length];

        // 根据数据初始化员工对象
        for (int i = 0; i < EMPLOYEES.length; i++) {
            String[] empData = EMPLOYEES[i];
            int type = Integer.parseInt(empData[0]);
            int id = Integer.parseInt(empData[1]);
            String name = empData[2];
            int age = Integer.parseInt(empData[3]);
            double salary = Double.parseDouble(empData[4]);

            switch (type) {
                case EMPLOYEE:
                    employees[i] = new Employee(/* 参数 */);
                    break;
                case PROGRAMMER:
                    employees[i] = new Programmer(/* 参数 */);
                    break;
                case DESIGNER:
                    double bonus = Double.parseDouble(empData[5]);
                    employees[i] = new Designer(/* 参数 */);
                    break;
                case ARCHITECT:
                    double archBonus = Double.parseDouble(empData[5]);
                    double stock = Double.parseDouble(empData[6]);
                    employees[i] = new Architect(/* 参数 */);
                    break;
            }
        }

        // 遍历并输出员工信息
        System.out.println("编号\t姓名\t年龄\t薪资\t语言\t奖金\t股票");
        for (Employee emp : employees) {
            // 输出员工信息
        }
    }

}
